<html>
<head>
<script type="text/javascript">
	function changeImg() {
		var imgSrc = $("#imgObj");
		var scr = imgSrc.attr("src");
		imgSrc.attr("src", chgUrl(src));
	}
	//时间戳
	//未来使每次生成的图片不一致，即不让浏览器读缓存，所以需要加上时间戳
	function chgUrl(url) {
		var timestamp = (new Date()).valueOf();
		var urlStr = url.substring(0, 17);
		if(url.indexOf("&") >= 0) {
			urlStr = url + "xtamp=" + timestamp;
		} else {
			urlStr = url + "?timestamp=" + timestamp;
		}
		return urlStr;
	}
	
	function isRightCode() {
		var code = $("#verifyCode").val();
		code = "c="+code;
		$.ajax({
			type : "POST",
			url : "${mainDomain}/backend/validateCode.action",
			data : code,
			success : function(data) {
				$("#info").html(data);
			}
		});
	}
</script>
</head>
<body >
	<div id="cc" class="easyui-layout" style="width:100%;">
		<input id="verifyCode" name="verifyCode" type="text" />
		<img id="imgObj" alt="" src="${mainDomain}/backend/verifyCode.action" />
		<a href="" onclick="changeImg()">换一张</a>
		<input type="button" value="验证" onclick="isRightCode()" />
		<div id="info"></div>
	</div>
	<script>
	var mainDomain = "${mainDomain}";
	var miscDomain = '${mainDomain}';
</script>
</body>
</html>